|
![](/i/fill.gif) |
On Sat, 23 Jan 1999 14:09:06 +1300, The Crazy Mule
<smi### [at] paradise net nz> wrote:
>If we say a function RayHits finds out where, if anywhere, the ray hits on a
>single hf tile, then we can use the following recursive wrapper function to
>extend functionality to infinitely tiled:
>
>Function RayHitsHF(Ray) {
> Modulus the ray origin or entry point to find where on a single tile it
>enters/starts
> If (RayHits) then return hitpoint
> else {
> If(Ray Exits Top or bottom) then return no intersection
> Else RayHitsHF(ray_exitpoint translated to the opposite edge of the tile
>bounding box)
> }
>}
You'll still have glitches along the edges, unless you use a tileable
image and kludge the hf to wrap around correctly. But why should it
be recursive? It seems like you're just following the ray through a
virtual "grid" of heightfields, finding any intersections for each
instance of the heightfield. No need for recursion there. You will,
as you say, have to terminate somehow. I can't think of any way to
detect a ray that is parallel to the bounding slab but that does not
intersect the height field at any point, so maybe you'd have to bail
out after traversing a set number of grid squares or a set distance.
This isn't a bad idea, and it seems far easier to implement than one
might at first think. A further modification might be to "flip"
adjacent copies of the HF along the appropriate axes, to make it
tile relatively smoothly without the need for a tileable image.
Post a reply to this message
|
![](/i/fill.gif) |